<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>问答详情</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
		<style>
			body {
			}
			.padding-top4 {
				padding-top: 4px;
			}
			.padding-left33 {
				padding-left: 33px
			}
			.bottom_span {
				bottom: 10px;
				position: absolute;
				right: 10px;
			}
			.p_style {
				width: 100%;
				margin-bottom: 0;
				line-height: 40px;
				padding-left: 11px;
				background-color: #FFFFFF;
			}
			.padding-top4 {
				padding-top: 4px;
			}
			.padding-left33 {
				padding-left: 33px;
			}
			.user_pic {
				width: 40px;
				height: 40px;
				border-radius: 20px;
				border: 2px solid #fff;
			}
		</style>
	</head>
	<body>
		<div id="mian" >
			<ul class="mui-table-view" style="background-color: #f0f0f0;">
				<li class="mui-table-view-cell">
					<div class="clearfix">
						<p class="base_black_grey base_title_font ">
							提问内容
						</p>
						<div class="base_black_grey base_content_font padding-top4 padding-left33" id="content"></div>
						<div class="padding-left33 padding-top4 " style="text-align: center;padding-right: 10px;">
							<img class="mui-pull-left " src="../../image/course_placehoder.png" style="max-width:100%;display:none;" id="qusestion_pic">
							<!--<samp  class="base_grey base_tag_font bottom_span"> 2016-1-1 12:10</samp>-->
						</div>
					</div>
				</li>
			</ul>
			<div hidden="hidden" id="stuListDiv">
			<p class="base_dark_grey base_title_font   p_style">
				提问详情
			</p>
			<div class="div_divider"></div>
			<ul class="mui-table-view" id="stuList">
				<!--	<li class="mui-table-view-cell">
				<div class="clearfix" style="line-height: 40px;">
				<img class="user_pic left" src="../../image/bujige.png" >
				<span class="base_dark_grey base_content_font left_10 left"> 张三 </span>
				<span class="base_grey base_content_font right"> 2016-1-2 10:30 </span>
				</div>
				</li>-->
			</ul>
			</div>
		</div>
		<div class="noSign" hidden="hidden" id="noData">
			<img src="../../image/icon_img.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				暂无数据
			</p>
		</div>
		<div class="loadFailure" hidden="hidden" id="noNet">
			<img src="../../image/icon_img01.png" width="60%">
			<p class="" >
				数据加载失败
			</p>
			<p>
				请检查您的网络
			</p>
			<button type="button"  onclick="loadNewData()"class="mui-btn mui-btn-outlined">
				重新加载
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/timeStampTool.js"></script>
	<script src="../../script/common.js"></script>
	<script type="text/javascript">
		var page = 1;
		var row = 10;
		var refreshCount = 0;
		apiready = function() {
		showProgress();
			getdata();
			if(api.pageParam.is_teacher==false){//学生身份
			  SendBehaviorTrajectoriesNotifi_Authentication('1', '学生端提问结果页', '181', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title, '');
			}
			loadNewData();
			setRefreshHeader();
			setPullUpRefresh();
		};
		//获取数据
		function getdata() {
			
			var params = {
				iid : api.pageParam.id,
				tid : 2
			}
			cfnetppPOST(url_ActiveInfo, params, true, function(data, status) {
				//				alert(JSON.stringify(data));
				//				api.hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						$('#noData').hide();
						$('#noNet').hide();
						$('#mian').show();
						setQusetionData(data.data);
					} else {
						$('#noData').hide();
						$('#noNet').show();
						$('#mian').hide();
						$('#stuListDiv').hide();
					}
				} else {
					$('#noData').hide();
					$('#noNet').show();
					$('#mian').hide();
					$('#stuListDiv').hide();
				}
			})
		}

		function setQusetionData(data) {
			if (data.upfile != '' && data.upfile != null) {
				$('#qusestion_pic').show()
				$('#qusestion_pic').attr('src', data.upfile);
				$("#qusestion_pic").click(function(){
	               var imgArr = new Array();
				    imgArr.push(data.upfile);
				    showimg(imgArr, 0);
                 });
			} else {
				$('#qusestion_pic').hide();
			}
			$('#content').text(data.content);
		}

		//获取数据
		function loadData() {
		
			var params = {
				jid : $api.getStorage('cfnetppjxid'),
				uid : $api.getStorage('cfnetppuid'),
				tid : 2,
				iid : api.pageParam.id,
				page : page,
				rows : row
			};
			//			 alert(JSON.stringify(params));
			cfnetppPOST(url_askNameList, params, true, function(data, status) {
				//			    alert(JSON.stringify(data));
				api.hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.code == 200) {
						var listdata = data.data;
						if (listdata != '' && listdata.constructor == Array && listdata.length > 0) {
							$('#noData').hide();
							$('#noNet').hide();
							$('#mian').show();
							$('#stuListDiv').show();
							refreshCount = listdata.length;
							writelist(listdata, refreshCount);
						} else {
							//							$('#noData').show();
							//							$('#noNet').hide();
						}
					} else if (data.code = 108) {
						//					if(page ==1){
						//						$('#noData').show();
						//						$('#noNet').hide();
						//						$('#mian').hide();
						//						}
					} else {
						//					  if(page ==1){
						//						$('#noData').show();
						//						$('#noNet').hide();
						//						$('#mian').hide();
						//						}
					}
				} else {
					//					$('#noData').hide();
					//					$('#noNet').show();
					//					$('#mian').hide();
				}
			});
		}

		function writelist(listdata, len) {
			var htmlsdata = '';
			for (var i = 0; i < len; i++) {
				var data = listdata[i];
				var htmls = '	<li class="mui-table-view-cell">' + '<div class="clearfix" style="line-height: 40px;">' + '<img class="user_pic left" src="' + HeadPortraitIsNull(data.picurl) + '" onerror="Imgnofind()" >' + '<span class="base_dark_grey base_content_font left_10 left">' + data.stuname + '</span>' + '<span class="base_grey base_content_font right"> ' + timeWithStamp3(data.starttime) + '</span>' + '</div>' + '</li>';
				htmlsdata = htmlsdata + htmls;
			}
			if (page == 1) {
				$('#stuList').html(htmlsdata);
			} else {
				$('#stuList').append(htmlsdata);
			}
		}
	</script>
</html>